<template>
  <div class="wrapper">
    <div class="bg"></div>
    <van-nav-bar title="书籍状态" class="navbar">
      <template #left>
        <van-icon
          name="arrow-left"
          class="icon"
          size="20"
          @click="onClickLeft"
        />
      </template>
    </van-nav-bar>
    <navbar @changeIndex="changeIndex"></navbar>
    <bread ref="bread"></bread>
  </div>
</template>

<script>
import navbar from "@/components/Navbar";
import bread from "@/components/bread";
export default {
  data() {
    return {
      currentIndex: 0,
    };
  },
  components: {
    navbar,
    bread,
  },
  mounted() {
    this.$refs.bread.changeIndex(1);
  },
  methods: {
    onClickLeft() {
      this.$router.back();
    },
    changeIndex(index) {
      this.currentIndex = index;
      this.$refs.bread.changeIndex(index);
      console.log(this.currentIndex);
    },
  },
};
</script>

<style scoped>
.bg {
  background: #ececec;
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
}
.navbar {
  position: sticky;
  top: 0;
  left: 0;
}
.icon {
  color: #808080;
}
</style>